This invention relates to a multiplication circuit having a rounding function which is used for digital signal processing such as image data processing.
MPEG2 (Moving Pictures Expert Group Phase 2)is well known as a standard type in the art of image data compression. In the image data processing, product-sum operation, i.e., plural multiplications and accumulative addition of the multiplied results thereof often appear. Rounding-down and rounding-off are keys to rounding processing of the products in MPEG2.
The rounding process in a conventional multiplication circuit is explained. A product P is obtained by multiplication of a multiplicand X and a multiplier factor Y. Suppose, for example, that the multiplicand X and the multiplier factor Y are 16-bit fixed-point numbers and are binary numbers in two's complement notation. Namely, each most significant bit of the multiplicand X and the multiplier factor Y is a sign bit. The product P in 31-bit length is obtained at the multiplication circuit. The most significant bit of the product P is a sign bit and is determined according to the sign bits of the multiplicand X and the multiplier factor Y.
In a case where the product P is rounded down so as to obtain a 16-bit rounded result PR as well as the multiplicand X and the multiplier factor Y, the less significant 15 bits of the product P are deleted with no condition, irrespective of the sign of the product P, and the remaining 16 bits are used as the rounded result PR.
As well, in a case where the product P is rounded off so as to obtain a 16-bit rounded result PR, 1 is added to the 15th bit, counting from the least significant bit, of the 31-bit product P, the less significant 15 bits of the thus added result are deleted and the remaining 16 bits are used as the rounded result PR.
Suppose that the radix point is positioned between the 15th bit and 16th bit, counting from the least significant bit, of the 31-bit product P, the processes of the above rounding-down and rounding-off are respectively expressed as FIGS. 6 and 7. Wherein, the decimal numeral is applied to FIGS. 6 and 7.
In the case of rounding-down, as shown in FIG. 6, +0.5 is rounded to 0 to thus decrease an absolute value and -0.5 is rounded to -1 to thus increase the absolute value. In other words, a change direction of the absolute value in associated with the rounding of the product P is different according to the sign of the product P. This is inconvenient for image data processing which executes accumulative addition of the rounded results of the products, because eccentric accumulation of the rounding error lowers image quality.
In the case of rounding-off, as shown in FIG. 7, +0.5 is rounded to 1 to thus increase the absolute value and -0.5 is rounded to 0 to thus decrease the absolute value, which lowers the image quality, also.